package org.imraniqbal.engine;

/**
 * @author  imran
 */
public abstract class Mappable {
	/**
	 * @uml.property  name="x"
	 */
	private int x;
	/**
	 * @uml.property  name="y"
	 */
	private int y;
	
	/**
	 * Creates a Mappable with given X and Y.
	 * @param x Desired X coordinate of the Mappable
	 * @param y Desired Y coordinate of the Mappable
	 * @author imran
	 */
	public Mappable(int x ,int y){
		this.setX(x);
		this.setY(y);
	}
	
	/**
	 * Change current Y value of Mappable
	 * @param y   new Y coordinate
	 * @uml.property  name="y"
	 */
	public void setY(int y) {
		this.y = y;
	}
	/**
	 * @return   Y value of Mappable
	 * @uml.property  name="y"
	 */
	public int getY() {
		return y;
	}
	/**
	 * Change current X value of Mappable
	 * @param x   new X coordinate
	 * @uml.property  name="x"
	 */
	public void setX(int x) {
		this.x = x;
	}
	/**
	 * @return   X value of Mappable
	 * @uml.property  name="x"
	 */
	public int getX() {
		return x;
	}
	/**
	 * @author imran
	 */
	@Override
	public boolean equals(Object obj){
		if(obj instanceof Mappable){
			return(((Mappable)obj).getX() == this.getX() && this.getY() == ((Mappable)obj).getY());
		}
		return false;
	}

}
